onPopulateAccessibilityEvent
Deprecated
Call onPopulateAccessibilityEvent directly. This method will be removed in a future release.
Called from dispatchPopulateAccessibilityEvent giving a chance to this View to populate the accessibility event with its text content.
Note: This method should only be used with getText. Avoid mutating other event state in this method. Instead, follow the practices described in dispatchPopulateAccessibilityEvent. In general, put UI metadata in the node for services to easily query, than in events.
Example: Adding formatted date string to an accessibility event in addition to the text added by the super implementation:
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(event);
final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY;
String selectedDateUtterance = DateUtils.formatDateTime(mContext,
mCurrentDate.getTimeInMillis(), flags);
event.getText().add(selectedDateUtterance);
}
If an AccessibilityDelegateCompat has been specified via calling setAccessibilityDelegate its onPopulateAccessibilityEvent is responsible for handling this call.
Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.
Parameters
The View against which to invoke the method.
The accessibility event which to populate.